# 动态规划50题 https://www.bilibili.com/video/BV1aa411f7uT
# 3/50 将数字变成0的操作次数
# leetcode第70题: https://leetcode.cn/problems/number-of-steps-to-reduce-a-number-to-zero/description/

def numberOfSteps(num: int) -> int:
    count = 0
    while num != 0:
        if num % 2 == 0:
            num //= 2
        else:
            num -= 1
        count += 1

    return count


print(numberOfSteps(14))
